const Koa = require('koa');
const route = require('koa-route');
const app = new Koa();
const main = ctx=>{
    if(ctx.require.path !=='/'){
        ctx.response.type = 'html'
        ctx.response.body = '<a href="/">Index Page</a>'
    }else{
        ctx.response.body = <h1>'hello world'</h1> }
}
app.use(main); //启动中间件